//引入公共文件
import '@utils/init.js';


import ajax from '@utils/ajax.js'
//获取专业数据
import { getProfession } from '@js/getData.js';
renderProfessionTable();

async function renderProfessionTable() {
    const professionData = await getProfession();
    const professionHtml = professionData.result.map(item => `<option value="${item._id}">${item.name}</option> `).join('');
    $('#professionId').html(professionHtml);
}

//新增班级
$('#addClassesBtn').click(async() => {
    const professionId = $('#professionId').val();
    const name = $('#classesName').val();
    const res = await ajax({
        url: '/classes/createClasses',
        type: "POST",
        data: {
            name,
            professionId
        },
    })
    if (res.code) {
        alert('班级新增成功')
    }


})